package com.jyw.business.de.wechat.controller;

import com.jyw.business.de.constant.DemandSourceConstant;
import com.jyw.business.de.constant.DemandTypeConstant;
import com.jyw.business.de.domain.dto.web.DemandInfoAddDto;
import com.jyw.business.de.service.IDeDemandAllocationService;
import com.jyw.business.de.service.IDeDemandInfoService;
import com.jyw.business.de.service.IDeDemandProcessService;
import com.jyw.business.de.service.IDeTaskInfoService;
import com.jyw.common.core.controller.BaseController;
import com.jyw.common.core.domain.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 需求-需求信息Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/wechat/de/demand/info")
@Api(tags = "需求池")
public class WxDeDemandInfoController extends BaseController
{
    @Autowired
    private IDeDemandInfoService deDemandInfoService;

    @Resource
    private IDeDemandAllocationService deDemandAllocationService;

    @Resource
    private IDeTaskInfoService taskInfoService;

    @Resource
    private IDeDemandProcessService processService;


    /**
     * 新增需求-需求信息
     */
    @PostMapping
    @ApiOperation("新增需求")
    public CommonResult add(@RequestBody @Valid DemandInfoAddDto dto)
    {
        //设置需求来源为新增
        dto.setDemandSource(DemandSourceConstant.ADD);
        //设置需求类型为新增
        dto.setDemandType(DemandTypeConstant.ADD);
        return CommonResult.success(deDemandInfoService.insertDeDemandInfo(dto));
    }
}
